package com.sphd.emanu.adapter;

import android.support.annotation.LayoutRes;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.text.Html;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sphd.emanu.R;
import com.sphd.emanu.pojo.bank.AccountIdBean;
import com.sphd.emanu.pojo.bank.AccountPeriodListByAccountBean;

import java.util.List;

/**
 * @Author Hu
 * @Time 2017/7/11 --14:23.
 * @Email 87683202@qq.com
 */
public class CardNumFragmentAdapter extends BaseQuickAdapter<AccountPeriodListByAccountBean,BaseViewHolder> {
    private boolean showIncome;//显示收入
    private boolean showExpend;//显示支出
    public CardNumFragmentAdapter(@LayoutRes int layoutResId, @Nullable List<AccountPeriodListByAccountBean> data,
                                  boolean showIncome, boolean showExpend) {
        super(layoutResId, data);
        this.showIncome = showIncome;
        this.showExpend = showExpend;
    }

    @Override
    protected void convert(BaseViewHolder helper, AccountPeriodListByAccountBean item) {
        AccountIdBean cardNumMessage = item.getAccountId();
        helper.setText(R.id.left_text,
                cardNumMessage.getAccount()+ "\n"+ cardNumMessage.getBankName()+"\n余额"+item.getBalance())
               .setText(R.id.right_text,
                Html.fromHtml((showIncome?
                        "<br/><font color='#36b6a9' size='20'>" + "收入" + item.getCredit():"")
                        +
                        (showExpend?
                                "<br/><font color='red' size='20'>" + "支出" + item.getDebit():"")));


    }
}
